$(function () {
  //获取banner图片
  $.ajax({
    type: 'POST',
    url: 'api/index/getBanner',
    data: '',
    dataType:'json',
    success(res){
      var html = ''
      for(var i in res.data){
        html += '<div class="swiper-slide">'+
          '<img src="' + res.data[i].imgurl + '" alt="">'+
          '</div>'
      }
      $('.swiper-wrapper').html(html);
      // 轮播图
      var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        loop:true,
        autoplay:4000,
        autoplayDisableOnInteraction : false
      });
    }
  });
})